/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.interceptors;

import javax.ejb.*;
import javax.interceptor.*;

/**
 *
 * @author sflesca
 */
public class Profiler {
    
    @AroundInvoke
    public Object profile(InvocationContext context) throws Exception{
        long itime = System.nanoTime();
        try{
            return context.proceed();
        } finally{
            long ftime = System.nanoTime();
            System.out.println("TEMPO DI ESECUZIONE:" + context.getMethod().getName() + " - " +(ftime-itime));
        }
    }
    
}
